public MeleeWepCaching()
{
	PrecacheModel("models/weapons/melee/v_bat.mdl", true);
	PrecacheModel("models/weapons/melee/v_cricket_bat.mdl", true);
	PrecacheModel("models/weapons/melee/v_crowbar.mdl", true);
	PrecacheModel("models/weapons/melee/v_electric_guitar.mdl", true);
	PrecacheModel("models/weapons/melee/v_fireaxe.mdl", true);
	PrecacheModel("models/weapons/melee/v_frying_pan.mdl", true);
	PrecacheModel("models/weapons/melee/v_golfclub.mdl", true);
	PrecacheModel("models/weapons/melee/v_katana.mdl", true);
	PrecacheModel("models/weapons/melee/v_machete.mdl", true);
	PrecacheModel("models/weapons/melee/v_tonfa.mdl", true);
	PrecacheModel("models/weapons/melee/w_bat.mdl", true);
	PrecacheModel("models/weapons/melee/w_cricket_bat.mdl", true);
	PrecacheModel("models/weapons/melee/w_crowbar.mdl", true);
	PrecacheModel("models/weapons/melee/w_electric_guitar.mdl", true);
	PrecacheModel("models/weapons/melee/w_fireaxe.mdl", true);
	PrecacheModel("models/weapons/melee/w_frying_pan.mdl", true);
	PrecacheModel("models/weapons/melee/w_golfclub.mdl", true);
	PrecacheModel("models/weapons/melee/w_katana.mdl", true);
	PrecacheModel("models/weapons/melee/w_machete.mdl", true);
	PrecacheModel("models/weapons/melee/w_tonfa.mdl", true);
	PrecacheGeneric("scripts/melee/baseball_bat.txt", true);
	PrecacheGeneric("scripts/melee/cricket_bat.txt", true);
	PrecacheGeneric("scripts/melee/crowbar.txt", true);
	PrecacheGeneric("scripts/melee/electric_guitar.txt", true);
	PrecacheGeneric("scripts/melee/fireaxe.txt", true);
	PrecacheGeneric("scripts/melee/frying_pan.txt", true);
	PrecacheGeneric("scripts/melee/golfclub.txt", true);
	PrecacheGeneric("scripts/melee/katana.txt", true);
	PrecacheGeneric("scripts/melee/machete.txt", true);
	PrecacheGeneric("scripts/melee/tonfa.txt", true);
}

public SpawnMeleeWeps_RS(){
	CreateTimer(30.0,SpawnMeleeWeps);
}

public Action:SpawnMeleeWeps(Handle:timer)
{
	new client = GetAnySurvivorX();
	if (client)
	{
		decl Float:SpawnPosition[3];
		decl Float:SpawnAngle[3];
		GetClientAbsOrigin(client, SpawnPosition);
		SpawnPosition[2] += 20;
		SpawnAngle[0] = 90.0;
		SpawnMelee("baseball_bat", SpawnPosition, SpawnAngle);
		SpawnMelee("baseball_bat", SpawnPosition, SpawnAngle);
		SpawnMelee("cricket_bat", SpawnPosition, SpawnAngle);
		SpawnMelee("cricket_bat", SpawnPosition, SpawnAngle);
		SpawnMelee("crowbar", SpawnPosition, SpawnAngle);
		SpawnMelee("crowbar", SpawnPosition, SpawnAngle);
		SpawnMelee("electric_guitar", SpawnPosition, SpawnAngle);
		SpawnMelee("electric_guitar", SpawnPosition, SpawnAngle);
		SpawnMelee("fireaxe", SpawnPosition, SpawnAngle);
		SpawnMelee("fireaxe", SpawnPosition, SpawnAngle);
		SpawnMelee("frying_pan", SpawnPosition, SpawnAngle);
		SpawnMelee("frying_pan", SpawnPosition, SpawnAngle);
		SpawnMelee("katana", SpawnPosition, SpawnAngle);
		SpawnMelee("katana", SpawnPosition, SpawnAngle);
		SpawnMelee("machete", SpawnPosition, SpawnAngle);
		SpawnMelee("machete", SpawnPosition, SpawnAngle);
		SpawnMelee("tonfa", SpawnPosition, SpawnAngle);
		SpawnMelee("tonfa", SpawnPosition, SpawnAngle);
	}
}

GetAnySurvivorX()
{
	new client = 1;
	while (client <= 32)
	{
		if (IsValidAliveSurv(client))
		{
			return client;
		}
		client++;
	}
	return 0;
}

SpawnMelee(String:Class[32], Float:Position[3], Float:Angle[3])
{
	decl Float:SpawnPosition[3];
	decl Float:SpawnAngle[3];
	SpawnPosition = Position;
	SpawnAngle = Angle;
	SpawnPosition[0] = SpawnPosition[0] + GetRandomInt(0, 20) + -10;
	SpawnPosition[1] += GetRandomInt(0, 20) + -10;
	SpawnPosition[2] += GetRandomInt(0, 10);
	SpawnAngle[1] = GetRandomFloat( 0.0, 360.0 );
	new MeleeSpawn = CreateEntityByName("weapon_melee", -1);
	DispatchKeyValue(MeleeSpawn, "melee_script_name", Class);
	DispatchSpawn(MeleeSpawn);
	TeleportEntity(MeleeSpawn, SpawnPosition, SpawnAngle, NULL_VECTOR);
}
